home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_ORBit.idb / usr / freeware / bin / orbit-config.z / orbit-config
Encoding:
Text File  |  1999-07-16  |  2.7 KB  |  152 lines

  1. #! /bin/sh
  2.  
  3. prefix=${ROOT}/usr/freeware
  4. exec_prefix=${prefix}
  5. exec_prefix_set=no
  6. includedir=${prefix}/include
  7.  
  8. usage()
  9. {
  10.     cat <<EOF
  11. Usage: orbit-config [OPTION]... [TARGET]...
  12.  
  13. Known values for OPTION are:
  14.  
  15.   --prefix=DIR        change ORBit prefix [default $prefix]
  16.   --exec-prefix=DIR    change ORBit executable prefix [default $exec_prefix]
  17.   --libs        print library linking information
  18.   --cflags        print pre-processor and compiler flags
  19.   --help        display this help and exit
  20.   --version        output version information
  21.  
  22.   --use-service=SRVC    the service SRVC will be used
  23.   
  24. Known values for SRVC are:
  25.     
  26.     name                module CosNaming, interfaces LNameComponent, LName
  27.  
  28. Known values for TARGET are:
  29.  
  30.     client        (calls ${ROOT}/usr/freeware/bin/glib-config)
  31.     server        (calls ${ROOT}/usr/freeware/bin/glib-config)
  32. EOF
  33.  
  34.     exit $1
  35. }
  36.  
  37. if test $# -eq 0; then
  38.     usage 1
  39. fi
  40.  
  41. cflags=false
  42. libs=false
  43.  
  44. while test $# -gt 0; do
  45.     case "$1" in
  46.     -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  47.     *) optarg= ;;
  48.     esac
  49.  
  50.     case "$1" in
  51.     --prefix=*)
  52.     prefix=$optarg
  53.     if test $exec_prefix_set = no ; then
  54.         exec_prefix=$optarg
  55.     fi
  56.     ;;
  57.  
  58.     --prefix)
  59.     echo $prefix
  60.     ;;
  61.  
  62.     --exec-prefix=*)
  63.     exec_prefix=$optarg
  64.     exec_prefix_set=yes
  65.     ;;
  66.  
  67.     --exec-prefix)
  68.     echo $exec_prefix
  69.     ;;
  70.  
  71.     --version)
  72.     echo ORBit 0.4.91
  73.     exit 0
  74.     ;;
  75.  
  76.     --help)
  77.     usage 0
  78.     ;;
  79.  
  80.     --cflags)
  81.            cflags=true
  82.            ;;
  83.  
  84.     --libs)
  85.            libs=true
  86.            ;;
  87.  
  88.     client|server)
  89.     the_libs="$the_libs -L${ROOT}/usr/freeware/${ABILIB-lib32} -lORBit -lIIOP -lORBitutil `${ROOT}/usr/freeware/bin/glib-config --libs`  -lm"
  90.     the_flags="$the_flags `${ROOT}/usr/freeware/bin/glib-config --cflags` -I${prefix}/include"
  91.     ;;
  92.  
  93.    --use-service=*)
  94.     case $optarg in
  95.         name)
  96.         services="$services -lORBitCosNaming"
  97.         ;;
  98.         *)
  99.         usage
  100.         exit 1
  101.         ;;
  102.     esac
  103.     ;;
  104.  
  105.     *)
  106.     usage
  107.     exit 1
  108.     ;;
  109.     esac
  110.     shift
  111. done
  112.  
  113. if $cflags; then
  114.     all_flags="$the_flags"
  115. fi
  116.  
  117. if $libs; then
  118.     all_flags="$all_flags $services $the_libs"
  119. fi
  120.  
  121. if test -z "$all_flags" || test "x$all_flags" = "x "; then
  122.     exit 1
  123. fi
  124.  
  125. # Straight out any possible duplicates, but be careful to
  126. # get `-lfoo -lbar -lbaz' for `-lfoo -lbaz -lbar -lbaz'
  127. other_flags=
  128. rev_libs=
  129. for i in $all_flags; do
  130.     case "$i" in
  131.     # a library, save it for later, in reverse order
  132.     -l*) rev_libs="$i $rev_libs" ;;
  133.     *)
  134.     case " $other_flags " in
  135.     *\ $i\ *) ;;                # already there
  136.     *) other_flags="$other_flags $i" ;;    # add it to output
  137.         esac ;;
  138.     esac
  139. done
  140.  
  141. ord_libs=
  142. for i in $rev_libs; do
  143.     case " $ord_libs " in
  144.     *\ $i\ *) ;;            # already there
  145.     *) ord_libs="$i $ord_libs" ;;    # add it to output in reverse order
  146.     esac
  147. done
  148.  
  149. echo $other_flags $ord_libs
  150.  
  151. exit 0
  152.